﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.FYBZ
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.FYBZ;

    public class wf_fybz_map : ClassMapping<wf_fybz>
    {
        public wf_fybz_map()
        {
            Id(x => x.n_id, map =>
            {
                map.Length(40);
                map.Column("n_id");
            });
            Property(x => x.is_valid, map => map.Column("is_valid"));
            Property(x => x.create_date, map => map.Column("create_date"));

            //费用部门
            ManyToOne(x => x.fy_dept, map =>
            {
                map.Column("fy_dept_id");
                map.NotNullable(false);
            });

            //费用所属项目
            ManyToOne(x => x.fy_proj, map =>
            {
                map.Column("fy_proj_id");
                map.NotNullable(false);
            });

            Property(x => x.ApprovalRecordId, map => map.Length(40));
            Property(x => x.sqEndDate);
            Property(x => x.sqEndFlag);
            Property(x => x.ProcessDescribe, map => map.Length(8000));

            Property(x => x.jedx, map => map.Column("jedx"));
            Property(x => x.jexx, map => map.Column("jexx"));
            Property(x => x.pjsl, map => map.Column("pjsl"));

            //关联详细记录记录
            Bag(x => x.details, map =>
            {
                map.Key(keyMapper => keyMapper.Column("n_id"));
            }, act => act.OneToMany());

            Table("wf_fybz");

            SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
